import HelloWorld from "./components/HelloWorld.vue";
import Subfield from "./components/Subfield.vue";

const components = [HelloWorld,Subfield];

const install = (Vue, options) => {
  if (install.installed) return;
  install.installed = true;
  components.forEach((component) => {
    Vue.component(component.name, component);
  });
};
// 如果是直接引入的vue.js方式，则会挂到window下
if (typeof window !== "undefined" && window.Vue) {
  install(window.Vue);
}
export default {
  // 使用Vue.use必须具有install方法
  install,
  ...components,
};
